<?php


namespace Application\controller;

use Application\model\BaseLoginModel;

class SuperLoginController extends LoginController
{


    protected function initLogin()
    {
        $m = parent::initLogin();
        $m = $this->initSuperLogin(true,$m);
        return $m;
    }

    protected function beforeSrid()
    {
    }

    public function serverlist()
    {
        $m = $this->initSuperLogin(false);

        //需要白名单，否则 查询报错
        // 获取最近登录区服列表
        list($last, $accountInfo) = $this->getLastLoginServers($m->account, $m->cpid);

        // 把玩家最近登录列表结合到区服列表
        list($sgids, $servers) = $this->getServers($accountInfo, $m->cpid);

        // 获取区服组的数据
        $groups = $this->model('Server')->getServerGroups($sgids);

        $this->success([
            'last' => $last,
            'servers' => $servers,
            'groups' => $groups,
        ]);

    }

}